package com.ys.data.auth.controller;

import com.common.vo.UserCodeVo;
import com.ys.data.auth.service.UserCodeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.common.pojo.Result;

import javax.annotation.Resource;

@Api(value = "用户中心API")
@RestController
@RequestMapping("userCode")
public class UserCodeController {

    @Resource
    private UserCodeService userCodeService;

    @ApiOperation(value = "添加用户中心数据",notes = "添加")
    @PostMapping("insert")
    public Result<?> saveUserCode(@RequestBody UserCodeVo userCodeVo){
        Result result = new Result();
        result.OK(userCodeService.saveUserCode(userCodeVo));
        return result;
    }

    @ApiOperation(value = "更新用户中心数据",notes = "更新")
    @PostMapping("update")
    public Result<?> updateUserCode(@RequestBody UserCodeVo userCodeVo){
        Result result = new Result();
        result.OK(userCodeService.updateUserCode(userCodeVo));
        return result;
    }

    @ApiOperation(value = "查询用户中心数据",notes = "查询")
    @PostMapping("find")
    public Result<?> findUserCode(@RequestBody UserCodeVo userCodeVo){
        Result result = new Result();
        result.OK(userCodeService.findUserCode(userCodeVo));
        return result;
    }
}
